<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="./lib/vue.js"></script>
    <title>计算机案例</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="z1">
        <select v-model="opt">
            <option value="+">+</option>
            <option value="-">-</option>
            <option value="*">*</option>
            <option value="/">/</option>
        </select>

        <input type="text" v-model="z2">

        <input type="button" value="="@click="daAn">

        <input type="text" v-model="zhao">

    </div>
</body>
<script>
     var vm = new Vue({
         el:"#app",
         data:{
             msg:"计算机喔",
             z1:0,
             z2:0,
             zhao:0,
             opt:"+"
         },
        methods: {
            daAn() {
                switch (this.opt) {
                    case '+':
                        this.zhao = parseInt(this.z1) + parseInt(this.z2)
                        break;
                    case '-':
                        this.zhao = parseInt(this.z1) - parseInt(this.z2)
                        break;
                    case '*':
                        this.zhao = parseInt(this.z1) * parseInt(this.z2)
                        break;
                    case '/':
                        this.zhao = parseInt(this.z1) / parseInt(this.z2)
                        break;
                }
            }
        }
    });
</script>
</html>